package com.sskj.mine.ui.activity;


import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.flyco.tablayout.SlidingTabLayout;
import com.sskj.common.adapter.MyFragmentPagerAdapter;
import com.sskj.common.base.App;
import com.sskj.lib.Constans;
import com.sskj.lib.RConfig;
import com.sskj.lib.base.BaseActivity;
import com.sskj.mine.R;
import com.sskj.mine.R2;
import com.sskj.mine.presenter.AssetRecordActivityPresenter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

@Route(path = RConfig.MINE_ASSERT_RECORD)//冲提币记录
public class AssetRecordActivity extends BaseActivity<AssetRecordActivityPresenter> {
    @BindView(R2.id.slidingTabLayout)
    SlidingTabLayout slidingTabLayout;
    @BindView(R2.id.viewPager)
    ViewPager viewPager;
    private List<String> titles = new ArrayList<>();
    private List<Fragment> fragments = new ArrayList<>();
    @Autowired
    String code;
    @Autowired
    String id;

    @Override
    protected int getLayoutResId() {
        return R.layout.mine_activity_asset_record;
    }

    @Override
    public AssetRecordActivityPresenter getPresenter() {
        return new AssetRecordActivityPresenter();
    }

    @Override
    protected void initView() {
        setTitle(App.INSTANCE.getString(R.string.mineAssetRecordActivity0));
        ARouter.getInstance().inject(this);
        titles.add(App.INSTANCE.getString(R.string.mineAssetRecordActivity1));
        titles.add(App.INSTANCE.getString(R.string.mineAssetRecordActivity2));
        titles.add(App.INSTANCE.getString(R.string.mineAssetRecordActivity3));
        fragments.add((Fragment) ARouter.getInstance().build(RConfig.MINE_FRAGMENT_ASSET_RECORD)
                .withString(Constans.ID, id)
                .withString(Constans.CODE, code)
                .withString(Constans.TYPE, "1")
                .navigation());
        fragments.add((Fragment) ARouter.getInstance().build(RConfig.MINE_FRAGMENT_ASSET_RECORD)
                .withString(Constans.ID, id)
                .withString(Constans.CODE, code)
                .withString(Constans.TYPE, "2")
                .navigation());
        fragments.add((Fragment) ARouter.getInstance().build(RConfig.MINE_FRAGMENT_OTHER_RECORD)
                .withString(Constans.CODE, code)
                .navigation());

        viewPager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(), titles, fragments));
        slidingTabLayout.setViewPager(viewPager);

    }
}
